package router

import (
	"broker/interface/iserver"
	"broker/struct/model"
	"broker/utils/logger"
	"strconv"
)

type PingRouter struct {
	BaseRouter
}

func NewPingRouter() *PingRouter {
	return &PingRouter{}
}

func (p *PingRouter) Handle(request iserver.IRequest, param interface{}) interface{} {
	pingResMsg := model.NewPingResMessage()
	logger.Info.Println("[PingRouter] ConnID = " + strconv.Itoa(int(request.GetConnection().GetConnID())) + " ,ping...")
	go request.GetConnection().SendMsg(pingResMsg)
	return nil
}
